package com.xqx.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;
import java.sql.SQLException;

/**
 * @author：xingquanxiang createTime：2019/10/12 20:12
 * description:
 */
@RestController
public class HelloController {
    @Autowired
    private DataSource dataSource;

    @Value("${xqx.url}")
    private String xqxUrl;

    @Value("${zyx.name}")
    private String zyxName;

    @GetMapping("/hello")
    public String hello() throws SQLException {
        System.out.println("xqxUrl = " + xqxUrl);
        System.out.println("zyxName = " + zyxName);
        System.out.println("dataSource = " + dataSource);
        System.out.println("dataSource.getConnection() = " + dataSource.getConnection());
        return "hello, Spring boot !";
    }

}
